package it.asvp.asvp_portal.data.entity.domain;

import it.asvp.asvp_portal.data.entity.member.Member;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@SuppressWarnings("serial")
@Entity
@Table(name = "convention", catalog = "asvp_db", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class Convention extends BaseEntity {

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "id_member", nullable = false)
  private Member  member;

  @ManyToOne(fetch = FetchType.EAGER)
  @JoinColumn(name = "id_address")
  @Cascade({ CascadeType.ALL })
  private Address address;

  @Column(name = "name", unique = true, nullable = false, length = 100)
  private String  name;

  @Column(name = "email")
  private String  email;

  @Column(name = "description", nullable = false, length = 1000)
  private String  description;

  @Column(name = "website_link")
  private String  websiteLink;

  @Column(name = "telefono", length = 20)
  private String  telefono;

  @Column(name = "active")
  private Boolean active;

  public Convention() {
  }

  public Convention(Member member, String name, String description, Date createdOn, Date lastUpdate, String telefono, Boolean active, Address address) {
    this.member = member;
    this.name = name;
    this.description = description;
    this.createdOn = createdOn;
    this.lastUpdate = lastUpdate;
    this.telefono = telefono;
    this.active = active;
    this.address = address;
  }

  public Member getMember() {
    return this.member;
  }

  public void setMember(Member member) {
    this.member = member;
  }

  public Address getAddress() {
    return this.address;
  }

  public void setAddress(Address address) {
    this.address = address;
  }

  public String getName() {
    return this.name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getEmail() {
    return this.email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

  public String getDescription() {
    return this.description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getWebsiteLink() {
    return this.websiteLink;
  }

  public void setWebsiteLink(String websiteLink) {
    this.websiteLink = websiteLink;
  }

  public String getTelefono() {
    return this.telefono;
  }

  public void setTelefono(String telefono) {
    this.telefono = telefono;
  }

  public Boolean getActive() {
    return this.active;
  }

  public void setActive(Boolean active) {
    this.active = active;
  }

}
